package org.example.demo;


/*
*  文字版格斗游戏,
*   每个游戏角色的姓名血量都不一样.  new的时候就确定
* 
* */
public class TestString1JavaBeanRole {
    private String name;
    private Integer xueCount;

    public TestString1JavaBeanRole(){}
    public TestString1JavaBeanRole(String name,Integer xueCount){
        this.name = name;
        this.xueCount = xueCount;
    }

    public  void gongji(TestString1JavaBeanRole role, Integer val){
        this.xueCount -=val;
        if(this.xueCount<=0){
            this.xueCount=0;
            System.out.println(role.getName() + "击倒了"+ this.getName());
        }else{
            System.out.println(role.getName() + "打了"+ this.getName()+ + val + "血");
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getXueCount() {
        return xueCount;
    }

    public void setXueCount(Integer xueCount) {
        this.xueCount = xueCount;
    }
}